<div class="layui-container">
    <div class="layui-row">
		<div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
			<div class="widget-head">
                    <div class="widget-title layer-cf">已处理售后</div>
                </div>
                <div class="widget-body layer-fr layui-col-sm12 layui-col-md12 layui-col-lg12">
                    <!-- 工具栏 -->
                    <div class="page_toolbar layer-margin-bottom-xs layer-cf">
                        <form id="form-search" class="layui-form" action="">
                            <input type="hidden" name="s" value="/{$request->pathinfo()}">
                            <input type="hidden" name="dataType" value="{$dataType}">
                            <div class="layui-col-sm12 layui-col-md12 ">
                                <div class="layui-col-sm12">
									    <div class="layui-col-md1 layui-col-flex">
										<label class="layui-form-label form-require">订单号：</label>
										</div>
										<div class="layui-col-sm3">
											<input type="text" class="layui-input" name="order_no"
												   placeholder="请输入订单号"
												   value="{$request->get('order_no')}">
										</div>
                                    						
                                    <div class="layui-col-sm1">
										<div class="sub-lst">
											<button class="layui-btn layer-btn-default layer-btn-success layer-magnify"
													type="submit">搜索</button>
										</div>
                                    </div>
									
									<div class="layui-col-sm3">
										<a class="j-export layui-btn layer-btn-success layer-radius"
										   href="javascript:void(0);">
											<i class="mdi menu-icon mdi-logout"></i>订单导出
										</a>
										{if $dataType heq 'delivery'}
											<a class="j-export layer-btn layer-btn-default layer-radius"
											   href="{:url('order/give')}">
												<i class="mdi menu-icon mdi-export"></i>批量发货
											</a>
										{/if}
								    </div>	
								</div>
							</div>
                        </form>
                    </div>

                    <div class="layui-col-md12">
							<table width="100%" class="layui-table">
							<thead>
							<tr>
                                <th width="30%" class="goods-detail">商品信息</th>
                                <th width="10%">单价/数量</th>
                                <th width="15%">实付款</th>
                                <th>买家</th>
                                <th>已处理售后</th>
                              
                            </tr>
                            </thead>
                            <tbody>
                            {if (!$list->isEmpty())}{foreach $list as $order}
                                <tr> 
                                    <td class="layer-text-middle layer-text-left" colspan="6" style="border-bottom:none;">
                                        <span class="layer-margin-right-lg"> {$order['create_time']}</span>
                                        <span class="layer-margin-right-lg">订单号：{$order['order_no']}</span>
                                    </td>
                               </tr>
                              
                                {foreach $order['goods'] as $i=>$goods}
                                    <tr>
                                        <td class="goods-detail layer-text-middle">
                                            <div class="goods-image">
                                                <img src="{$goods['image']}" alt="">
                                            </div>
                                            <div class="goods-info">
                                                <p class="goods-title">{$goods['name']}</p>
                                                <p class="goods-spec layer-link-muted">
                                                    {$goods['goods_attr']}
                                                </p>
                                            </div>
                                        </td>
                                        <td class="layer-text-middle">
                                            <p>￥{$goods['goods_price']}</p>
                                            <p>×{$goods['total_num']}</p>
                                        </td>
										
                                        {if ($i == 0 )}
										
                                            <td class="layer-text-middle" rowspan="{count($order['goods'])}">
                                                <p>￥{$order['pay_price']}</p>
                                                <p class="layer-link-muted">(含运费：￥{$order['express_price']})</p>
                                            </td>
                                            <td class="layer-text-middle" rowspan="{count($order['goods'])}">
                                                <p>{$order['user']['nickName']}</p>
                                                <p class="layer-link-muted">(用户id：{$order['user']['user_id']})</p>
                                            </td>
                                            <td class="layer-text-middle" rowspan="{count($order['goods'])}">
                                                <p>付款状态：
                                                    <span class="layer-badge
                                                {$order['pay_status']['value'] === 20 ? 'layer-badge-success' : ''}">
                                                        {$order['pay_status']['text']}</span>
                                                </p>
                                                <p>发货状态：
                                                    <span class="layer-badge
                                                {$order['delivery_status']['value'] === 20 ? 'layer-badge-success' : ''}">
                                                        {$order['delivery_status']['text']}</span>
                                                </p>
                                                <p>收货状态：
                                                    <span class="layer-badge
                                                {$order['receipt_status']['value'] === 20 ? 'layer-badge-success' : ''}">
                                                        {$order['receipt_status']['text']}</span>
                                                </p>
                                            </td>
                                           
                                        {/if}
                                    </tr>
                                {/foreach}
                            {/foreach} {else/}
                                <tr>
                                    <td colspan="6" class="layer-text-center">暂无记录</td>
                                </tr>
                            {/if}
                            </tbody>
                        </table>
                    </div>
                    <div class="layui-col-lg12 layer-cf">
                        <div class="layui-fr">{$list|raw} </div>
                        <div class="layui-fr pagination-total layer-margin-right">
                            <div class="layer-vertical-align-middle">总记录：{$list->total()}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>

    $(function () {

        /**
         * 订单导出
         */
        $('.j-export').click(function () {
	
            var data = {};
            var formData = $('#form-search').serializeArray();
            $.each(formData, function () {
                this.name !== 's' && (data[this.name] = this.value);
            });
            window.location = "{:url('operate/export')}" + '&' + $.urlEncode(data);
        });

    });

</script>

